package com.atguigu.yygh.exception;

import com.atguigu.yygh.result.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * zz: wzh
 * time 2022 08 05 22 34
 **/
@ControllerAdvice
public class GlobalExceptionHandller {
    @ResponseBody
    @ExceptionHandler(Exception.class)
    public Result error(Exception e){
        e.printStackTrace();
        return Result.fail();
    }
    @ResponseBody
    @ExceptionHandler(YyghException.class)
    public Result errot(YyghException e){
        e.printStackTrace();
        return Result.fail();
    }
}
